import Vue from 'vue'
import App from './App.vue'
import './registerServiceWorker'
import router from './router'
import store from './store'

Vue.config.productionTip = false

// 全局注册组件
import head from "@/components/head.vue" // 引入的是 在文件夹创建的 head 组件
Vue.component("myhead", head) // 注册 head 组件  赋名为 myhead(赋名可以随便取)  然后在APP 里展示 myhead

import nav from "@/components/nav.vue"
Vue.component("myNav", nav)

import parent from "@/components/parent.vue"
Vue.component("parent", parent)
import childone from "@/components/childone.vue"
Vue.component("childone", childone)
import childtwo from "@/components/childtwo.vue"
Vue.component("childtwo", childtwo)


//挂载到根实例
import {bus} from "@/utils/bus.js"
Vue.prototype.$bus = bus // 可全局获取 this.$bus


new Vue({
  router, // 挂载路由 this.$router

  watch: { //监听来自哪里和去哪里
    '$route': function (to, from) {
      console.log("to", to);
      console.log("from", from);
    }
  },

  store,
  render: h => h(App)
}).$mount('#app')
